﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ITProject.Domain;
using ITProject.Domain.Entities;

namespace ITProject.WebUI.Models
{
    public static class StatusName
    {
        public const string Active = "Aktywny";
        public const string Planned = "Planowany";
        public const string Done = "Wykonany";
        public const string Tested = "Przetestowany";
        public const string Accepted = "Zaakceptowany";
        
        public static Status ConvertFromString(string statusString)
        {
            Status status = Status.Active;
            switch (statusString)
            {
                case Accepted:
                    status = Status.Accepted;
                    break;
                case Active:
                    status = Status.Active;
                    break;
                case Done:
                    status = Status.Done;
                    break;
                case Tested:
                    status = Status.Tested;
                    break;
                case Planned:
                    status = Status.Planned;
                    break;
            }
            return status;
        }

        public static string ConvertFromStatus(Status status)
        {
            string statusString="";
            switch(status)
            {
                case Status.Active:
                    statusString=Active;
                    break;
                case Status.Accepted:
                    statusString=Accepted;
                    break;
                case Status.Done:
                    statusString=Done;
                    break;
                case Status.Planned:
                    statusString=Planned;
                    break;
                case Status.Tested:
                    statusString=Tested;
                    break;
            }
            return statusString;
        }

        public static string ConvertFromByteNullable(byte? status)
        {
            if (status == null)
                return "";
            string statusString = "";
            switch (status)
            {
                case (byte)Status.Active:
                    statusString = Active;
                    break;
                case (byte)Status.Accepted:
                    statusString = Accepted;
                    break;
                case (byte)Status.Done:
                    statusString = Done;
                    break;
                case (byte)Status.Planned:
                    statusString = Planned;
                    break;
                case (byte)Status.Tested:
                    statusString = Tested;
                    break;
            }
            return statusString;
        }

        public static string ConvertFromByte(byte status)
        {
            string statusString = "";
            switch (status)
            {
                case (byte)Status.Active:
                    statusString = Active;
                    break;
                case (byte)Status.Accepted:
                    statusString = Accepted;
                    break;
                case (byte)Status.Done:
                    statusString = Done;
                    break;
                case (byte)Status.Planned:
                    statusString = Planned;
                    break;
                case (byte)Status.Tested:
                    statusString = Tested;
                    break;
            }
            return statusString;
        }
    }
}